// pages/allSubject/allSubjects.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:" ",
    list: [
      {
        name: "语文",
        url: "/../icons/chinese.png",
        flag: "false"
      },

      {
        name: "数学",
        url: "/../icons/math.png",
        flag: "false"
      },

      {
        name: "英语",
        url: "/../icons/english.png",
        flag: "false"
      },

      {
        name: "物理",
        url: "/../icons/physical.png",
        flag: "false"
      },

      {
        name: "化学",
        url: "/../icons/chemical.png",
        flag: "false"
      },

      {
        name: "政治",
        url: "/../icons/political.png",
        flag: "false"
      },

      {
        name: "历史",
        url: "/../icons/history.png",
        flag: "false"
      },

      {
        name: "地理",
        url: "/../icons/geographic.png",
        flag: "false"
      },

      {
        name: "生物",
        url: "/../icons/biological.png",
        flag: "false"
      }
    ],
  },

  switchChange: function(e) {
    console.log(e);
    if(e.detail.value)
    {
      this.setData({
        name: this.data.name + e.currentTarget.dataset.operation + " "
      });
    }else
    {
      this.setData({
        name: this.data.name.replace(e.currentTarget.dataset.operation + " ",'')
      });
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  },

})